/**  
 * All rights Reserved, Designed By www.woniuxy.com
 * @Title:  Account.java   
 * @Package com.woniu.domain   
 * @Description:    Description  
 * @author: 蜗牛学院  
 * @date:   2019年8月24日 上午10:47:07
 * @user:   Administrator  
 * @version V1.0 
 * @Copyright: 2019 www.woniuxy.com Inc. All rights reserved. 
 * 注意：本内容仅限于成都蜗牛创想科技有限公司，禁止外泄以及用于其他的商业目
 */ 
package com.woniu.controller;

import java.sql.SQLException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;
import com.woniu.domain.User;
import com.woniu.service.UserService;

/**
 * @author Administrator
 *
 */
@Controller
@Scope("prototype")
public class UserAction {
	@Autowired
	UserService userService;
	User user;
	public String login() {
		
			User u = userService.fingUserByUserName(user.getUname());
			if(u==null) {
				ActionContext.getContext().put("usererrorinfo", "用户名不存在");
				return "error";
			}else if(u.getUpwd().equals(user.getUpwd())) {
				ActionContext.getContext().getSession().put("userinfo", u);
				return "login";
			}else {
				ActionContext.getContext().put("usererrorinfo", "密码错误");
				return "error";
			}
		 
//		return "";
	}
	/**
	 * @return the user
	 */
	public User getUser() {
		return user;
	}
	/**
	 * @param user the user to set
	 */
	public void setUser(User user) {
		this.user = user;
	}
	
}
